#! /usr/bin/python
import roslib
roslib.load_manifest('rospy')
roslib.load_manifest('actionlib')
roslib.load_manifest('pr2_controllers_msgs')

import rospy
import actionlib
from actionlib_msgs.msg import *
from pr2_controllers_msgs.msg import *

rospy.init_node('move_the_gripper', anonymous=True)

client = actionlib.SimpleActionClient('r_gripper_controller/gripper_action', Pr2GripperCommandAction)
client.wait_for_server()

rospy.loginfo("Attempting to Close Gripper")
rospy.loginfo("Sending Close Goal")
client.send_goal(Pr2GripperCommandGoal(
	Pr2GripperCommand(position = 0.00, max_effort = -1)))
client.wait_for_result()

result = client.get_result()
did = []
if client.get_state() != GoalStatus.SUCCEEDED:
    rospy.loginfo("failed")
else:
    rospy.loginfo("reached goal")
